package com.ruoyi.framework.config.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 登录错误配置
 *
 * @author 刘逸晖
 */
@Component
@ConfigurationProperties(prefix = "ruoyi.login.error")
public class LoginErrorProperties {

    /**
     * 每个 ip 最多可以登录错误的次数
     */
    private Integer maxCount;

    /**
     * 这是一个缓存的 key ，对应的值是每个 ip 登录错误的数量
     */
    private String countKeyPrefix;

    /**
     * key 的过期时间，单位分钟
     * Spring Data Redis 中要的是 long
     */
    private Long expiration;

    @Override
    public String toString() {
        return "LoginErrorProperties{" +
                "maxCount=" + maxCount +
                ", countKeyPrefix='" + countKeyPrefix + '\'' +
                ", expiration=" + expiration +
                '}';
    }

    public Integer getMaxCount() {
        return maxCount;
    }

    public void setMaxCount(Integer maxCount) {
        this.maxCount = maxCount;
    }

    public String getCountKeyPrefix() {
        return countKeyPrefix;
    }

    public void setCountKeyPrefix(String countKeyPrefix) {
        this.countKeyPrefix = countKeyPrefix;
    }

    public long getExpiration() {
        return expiration;
    }

    public void setExpiration(long expiration) {
        this.expiration = expiration;
    }
}
